﻿package com.utils {
	import flash.display.Stage;
	import flash.net.LocalConnection;

	/**
	 * ...
	 * @author Liseen
	 */
	public class URI {
		private static var _domain:String = ""; //Config.GameServerDomain; //"4x001.xd.com"
		private static var _serverPort:int = 9000; //Config.GameServerPort; //8000
		private static var _clientUrl:String = ""; //Config.ResourcesPathPrefix; //"http://sxd.xdcdn.net/2012030301/"
		private static var _policyPort:int = 888;
		private static var _gateWayPort:int = 10010;
		private static var _args:Object = {};
		private static var _assetsUrl:String;
		private static var _fullClientUrl:String;
		private static var _version:Object = {};
		public static var test:Boolean = false;
		private static var _stage:Stage;
		private static var _lc:LocalConnection = new LocalConnection();

		public function URI() {

		}

		public static function get ip():String {

			return (_args["ip"] || _domain || "");

		}

		public static function get port():int {
			return (_args["port"] || _serverPort || 0);
		}

		public static function get assetsRnd():String {
			return (_args["assets_rnd"] || "201203032225");
		}

		public static function get avatarUrl():String {
			return _assetsUrl + "roles/avatar/";
		}

		public static function get assetsUrl():String {
			return _assetsUrl;
		}

		public static function get worldBossUrl():String {
			return ((_assetsUrl + "map/world_boss/"));
		}

		public static function get clientUrl():String {
			return _clientUrl;
		}

		public static function get playerName():String {
			return _args["player_name"] || "6666662";
		}

		public static function get hashCode():String {
			return _args["hash_code"] || "59857d7a43d23fcdb577a71e347c26a3";
		}

		public static function get time():String {

			return (_args["time"]) || "1331241281";
		}

		public static function get researchIconUrl():String {
			return ((_assetsUrl + "icons/research/"));
		}

		public static function get regdate():int {
			return _args["regdate"] || 1331280310;
		}

		public static function get sourceUrl():String {
			return (((_args["source"]) || ("")));
		}

		public static function get chooseRolesUrl():String {
			return (_assetsUrl + "icons/choose_roles/");
		}

		public static function get weiBoNickName():String {
			return "";
		}

		public static function get weiBoGender():String {
			return "";
		}

		public static function get vipHidden():Boolean {
			return false;
		}

		public static function get sportUrl():String {
			return ((_assetsUrl + "map/sport/"));
		}

		public static function get rechargeUrl():String {
			return (((_args["recharge"]) || ("")));
		}

		public static function get vipInfoUrl():String {
			return (((_args["vip_info"]) || ("")));
		}

		public static function get goodsIconUrl():String {
			return (_assetsUrl + "icons/goods/");
		}

		public static function get addonsUrl():String {
			return (_assetsUrl + "addons/");
		}

		public static function get iconsUrl():String {
			return (_assetsUrl + "roles/icons/");
		}

		public static function get townUrl():String {
			return (_assetsUrl + "map/town/");
		}

		public static function get buffIconUrl():String {
			return (_assetsUrl + "icons/buff/");
		}

		public static function get bossUrl():String {
			return (_assetsUrl + "icons/boss/");
		}

		public static function get missionUrl():String {
			return (_assetsUrl + "map/mission/");
		}

		public static function get sportIconUrl():String {
			return ((_assetsUrl + "roles/super_sport/"));
		}

		public static function get warRolesUrl():String {
			return (_assetsUrl + "roles/war/");
		}

		public static function get stuntsUrl():String {
			return (_assetsUrl + "roles/stunts/");
		}

		public static function get effectsUrl():String {
			return (_assetsUrl + "roles/effects/");
		}

		public static function get dramaUrl():String {
			return (_assetsUrl + "drama/");
		}

		public static function get mapUrl():String {
			return (_assetsUrl + "map/");
		}

		public static function get npcIconUrl():String {
			return (_assetsUrl + "icons/npc/");
		}

		public static function get roleUrl():String {
			return (_assetsUrl + "roles/");
		}

		public static function get screenUrl():String {
			return (_assetsUrl + "roles/screen/");
		}

		public static function get studyStuntIconUrl():String {
			return ((_assetsUrl + "icons/study_stunt/"));
		}

		public static function get isBaidu():Boolean {
			return ((parseInt(_args["baidu"]) == 1));
		}

		public static function get soundUrl():String {
			return ((_assetsUrl + "map/sound/"));
		}

		public static function get serverUrl():String {
			return (((_args["server_url"]) || ("")));
		}

		public static function get farmIconUrl():String {
			return ((_assetsUrl + "icons/farm/"));
		}

		public static function analyze(_arg1:Object):void {
			_stage = _arg1.stage;
			var _local2:Object = _stage.getChildAt(0);
			if (_local2.hasOwnProperty("args")) {
				_args = _local2.args;
			}
			if (_args["client_url"]) {
				_clientUrl = _args["client_url"];
			}
			_assetsUrl = (_clientUrl + "assets/");
			if ("./" == _clientUrl) {
				_fullClientUrl = _arg1.loaderInfo.url.replace(/(Main|rw)\.swf(\?[\s\S]+?)?/, "");
			} else {
				_fullClientUrl = _clientUrl;
			}
		}

		public static function nickNameSuffix(_arg1:Boolean = false):String {
			var _local2:String = ((_args["nickname_suffix"]) || (""));
			if (_arg1 && !(_local2 == "")) {
				_local2 = _local2.replace(".", "\\.");
				_local2 = _local2.replace("-", "\\-");
				_local2 = _local2.replace("[", "\\[");
				_local2 = _local2.replace("]", "\\]");
			}
			return (_local2);
		}

		public static function formatVersion(_arg1:String):void {
			var _local3:String;
			var _local4:Array;
			var _local2:Array = _arg1.split(/\r\n|\r|\n/g);
			for each (_local3 in _local2) {
				_local4 = _local3.split("|");
				if (_local4.length == 2) {
					_version[_local4[0]] = _local4[1];
				}
			}
		}

		public static function getVersion(_arg1:String):String {
			var _local4:int;
			_arg1 = _arg1.replace(_assetsUrl, "");
			var _local2:Array = _arg1.split("/");
			var _local3:int = _local2.length;
			if (_local3 > 1) {
				_arg1 = "";
				_local4 = 0;
				while (_local4 < (_local3 - 1)) {
					_arg1 = (_arg1 + ("/" + _local2[_local4].substr(0, 1)));
					_local4++;
				}
				_arg1 = (_arg1 + "/" + _local2[(_local3 - 1)]);
			} else {
				_arg1 = ("/" + _arg1);
			}
			_arg1 = ((_version[_arg1]) || (""));
			return _arg1;
		}

		public static function get openTime():int {
			return (_args["open_time"] || (0));
		}

		public static function get fateUrl():String {
			return _assetsUrl + "icons/fate/";
		}

		public static function getSoulsIconUrl(_arg1:int):String {
			return assetsUrl + "icons/souls/" + _arg1 + ".swf";
		}

		public static function get achievementUrl():String {
			return _assetsUrl + "icons/achievement/";
		}

		public static function getRoleIconUrl(_arg1:String):String {
			return iconsUrl + _arg1 + ".png";
		}

		public static function get activityUrl():String {
			return ((_assetsUrl + "icons/activity/"));
		}

		public static function get isMangguo():Boolean {
			return parseInt(_args["mangguo"]) == 1;
		}

		public static function get flowerUrl():String {
			return ((_assetsUrl + "icons/flower/"));
		}

		public static function get processTips():String {
			return ((_assetsUrl + "icons/process_tips/"));
		}

		public static function get triggerUrl():String {
			return ((_assetsUrl + "icons/trigger/"));
		}

		public static function get nonKid():Boolean {
			return ((parseInt(_args["non_kid"]) == 1));
		}

		public static function get soundEffectUrl():String {
			return ((_assetsUrl + "sound_effect/"));
		}

		public static function get publish():String {
			return (((_args["publish"]) || ("")));
		}

		public static function get missionBackgroudUrl():String {
			return ((_assetsUrl + "icons/mission/"));
		}

		public static function get qqYellowVip():int {
			return (((_args["is_yellow_vip"]) || (0)));
		}

		public static function get qqYellowYearVip():int {
			return (((_args["is_yellow_year_vip"]) || (0)));
		}

		public static function get qqYellowVipLevel():int {
			return (((_args["yellow_vip_level"]) || (0)));
		}

		public static function get qqBlueVip():int {
			return (((_args["is_blue_vip"]) || (0)));
		}

		public static function get qqBlueYearVip():int {
			return (((_args["is_blue_year_vip"]) || (0)));
		}

		public static function get qqBlueVipLevel():int {
			return (((_args["blue_vip_level"]) || (0)));
		}

//		public static function get platform():int {
//			var _local1:int = Mod_Player_Base.QQZONE;
//			switch (parseInt(_args["plat_form"])) {
//				case 1:
//					_local1 = Mod_Player_Base.QQZONE;
//					break;
//				case 2:
//					_local1 = Mod_Player_Base.PENGYOU;
//					break;
//				case 3:
//					_local1 = Mod_Player_Base.QQWEIBO;
//					break;
//				case 4:
//					_local1 = Mod_Player_Base.QQX;
//					break;
//				case 5:
//					_local1 = Mod_Player_Base.CAIFUTONG;
//					break;
//				case 6:
//					_local1 = Mod_Player_Base.QQGAME;
//					break;
//				case 7:
//					_local1 = Mod_Player_Base.WEB_SITE;
//					break;
//				case 8:
//					_local1 = Mod_Player_Base.PF_3366;
//					break;
//			}
//			;
//			return (_local1);
//		}
		//lxh5.15新加
	/*public static function get isPlatformB():Boolean{
		return ((parseInt(_args["platform_b"]) == 1));
	}
	public static function get isSogou():Boolean{
		return ((parseInt(_args["sogou"]) == 1));
	}
	public static function get serverName():String{
		return (((_args["server_name"]) || ("")));
	}*/
	}

}
